<?php

namespace Trawind\Basics\Traits\Console;


use Trawind\Helpers\UserHelper;

trait TenantConsole
{

    protected $tenant;

    final public function handle()
    {
        date_default_timezone_set("UTC");
        tenancy()->runForMultiple(null, function ($tenant) {
            $this->tenant = $tenant;
            UserHelper::setConsoleTenantId($tenant->tenant_id);

            $this->exec();
        });
    }

    abstract public function exec();

}